<?php
require_once("includes/pagetop.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>AllyFolio | Jobs List </title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"  />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
//<![CDATA[
$(document).ready(function(){
  $(".drop_btn").click(function(){
    $(".showbox").toggle();
  });
});

//]]>
</script>
</head>

<body>

	<div id="main_wrapper">
    <?php
    $pageheading="Careers";
    require_once("includes/header.php");
    
    if(!isset($Job["cat_id"]) || $Job["cat_id"]<=0 || $Job["cat_id"]=="")
    {
        redirect("careers.php");
    }
    
    $jobdetailsqry="select af_careers.*,cat_name from af_careers,af_categories where af_categories.id=af_careers.cat_id and cat_id=:catid and af_careers.job_status='Active'";
    $jobdetails=$pdodbobj->fetch_array($pdodbobj->query($jobdetailsqry,array(":catid"=>$_POST["Job"]["cat_id"])));
    
    if(count($jobdetails)==0)
    {
        $_SESSION["msg_error"]="There is no job posted in this category.";
        redirect("careers.php");
    }
    ?>
    <!--=================Body Contain Start=======================-->
    <div class="wrapper">
    	<div class="header">
        	        	<div class="contain-wrap">
							<div class="c2">
								<?php if(count($jobdetails)>0) echo $jobdetails[0]['cat_name']." Jobs List" ?>
							</div>
                            <form name="careerform" method="post">
                                <ol style="list-style-type: decimal;width: 436px;margin: 30px auto;">
                                    <?php
                                    for($i=0;$i<count($jobdetails);$i++)
                                    {
                                    ?>
                                    <li>
                                        <a style="font-style:inherit;color: inherit;" href="javascript:void(0);" onclick="return getdetails(<?php echo $jobdetails[$i]['id']; ?>);"><?php echo $jobdetails[$i]['post_name']; ?></a> 
                                    </li>
                                    <?php
                                    }
                                    ?>
                                </ol>
                                
                                <input type="hidden" name="Job[job_id]" id="jobid" />
                                <input type="hidden" name="Job[cat_id]" id="catid" value="<?php if(isset($_POST['Job']['cat_id'])){ echo $_POST['Job']['cat_id']; } ?>" />
                            </form>
							<div>
                            
                            </div>
							
						</div>
</div>
                </div>
            
            
		</div>
    </div>
    
    <div class="clearfix"></div>
    <!--=================Body Contain end=======================-->
    </div>
<?php
    require_once("includes/footer.php");
?>
<script lang="javascript">
//<![CDATA[
function getdetails(id)
{
    document.getElementById('jobid').value=id;
    document.careerform.action="job_details.php";
    document.careerform.submit();
}

//]]>
</script>